package cn.mengfly.testnrz.crazyIm.webclient.action;

import feign.Feign;
import feign.Param;
import feign.RequestLine;
import feign.codec.StringDecoder;

public interface UserAction {

    /**
     * 用户登录
     *
     * @param username 用户名
     * @param password 密码
     * @return 登录结果
     */
    @RequestLine("GET /login/{username}/{password}")
    String loginAction(@Param("username") String username, @Param("password") String password);

    /**
     * 获取用户信息
     *
     * @param userid 用户Id
     * @return 用户信息
     */
    @RequestLine("GET /{userid}")
    String getById(@Param("userid") Integer userid);


    static void main(String[] args) {
        UserAction action = Feign.builder()
                .decoder(new StringDecoder())
                .target(UserAction.class, "http://localhost:8080/user");
        String loginResult = action.loginAction("zhangsan", "zhangsan");
        System.out.println("loginResult = " + loginResult);
    }
}
